package cn.pzaily.orange.core.utils;

/**
 * @PackageName: cn.pzaily.common.utils
 * @Description:
 * @Author: Pang
 * @Date: 2021-03-06 12:54
 */
public class StringUtils {

    public static final String NULL_STR = "";

    public static final String SEPARATOR = "_";

    /**
     * 判断一个string对象是否为空
     *
     * @param str
     * @return true： 为空  false：非空
     */
    public static boolean isNull(String str) {
        return null == str;
    }

    /**
     * 判断一个string对象是否为空
     *
     * @param str
     * @return true 非空，false：空
     */
    public static boolean isNotNull(String str) {
        return !isNull(str);
    }

    /**
     * 判断字符串数组的为空
     *
     * @param strings
     * @return
     */
    public static boolean isNullArray(String[] strings) {
        return null == strings || strings.length == 0;
    }

    /**
     * 判断字符串数组不为空
     *
     * @param strings
     * @return
     */
    public static boolean isNotNullArray(String[] strings) {
        return !isNullArray(strings);
    }

    /**
     * 判断字符串是否为空字符串
     *
     * @param params
     * @return
     */
    public static boolean isEmpty(String params) {
        return isNull(params) || NULL_STR.equals(params.trim());
    }

    public static boolean isEmpty(Object str) {
        return str == null || "".equals(str);
    }

    public static boolean isNotEmpty(Object str) {
        return !isEmpty(str);
    }

    /**
     * 判断字符串不是空字符串
     *
     * @param params
     * @return
     */
    public static boolean isNotEmpty(String params) {
        return !isEmpty(params);
    }

    public static String format(String template, Object... params) {
        if (isEmpty(template) || ObjectUtils.isNull(params)) {
            return template;
        }
        return null;
    }

    public static String toUnderScoreCase(String str) {
        return null;
    }


}
